<template>
  <div class="bottom-tab">
      <ul>
          <router-link :to="item.url" tag="li" v-for="(item, index) in tabbar" :key="index" active-class="actived">
              <img :src="item.defaultUrl" alt="icon">
              <img class="selected" :src="item.selectedUrl" alt="icon">
              <p>{{item.content}}    </p>
          </router-link>
         
      </ul>
  </div>
</template>

<script>
export default {
    data() {
        return {
            tabbar: [
                {
                    content: '首页',
                    defaultUrl: require('../assets/tabbar/ic_index_default.png'),
                    selectedUrl: require('../assets/tabbar/ic_index_selected.png'),
                    url: '/home'
                },
                {
                    content: '分类',
                    defaultUrl: require('../assets/tabbar/ic_classifyq.png'),
                    selectedUrl: require('../assets/tabbar/ic_classifyh.png'),
                    url: '/classify'
                },
                {
                    content: '购物车',
                    defaultUrl: require('../assets/tabbar/ic_cart_default.png'),
                    selectedUrl: require('../assets/tabbar/ic_cart_selected.png'),
                    url: '/cart'
                },
                {
                    content: '我的',
                    defaultUrl: require('../assets/tabbar/ic_my_default.png'),
                    selectedUrl: require('../assets/tabbar/ic_my_selected.png'),
                    url: 'mine'
                }
            ]
        }
    }
}

</script>
<style scoped lang="scss">
.bottom-tab {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 99;
    background: rgba(255,255,255,0.90);
    box-shadow: inset 0 0 0 0 #E1E1E1;
    ul {
        height: 0.49rem;
        padding: 0 0.37rem;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        li {
            img {
                width: 0.25rem;
                height: 0.25rem;
            }
            .selected {
                display: none;
            }
            p {
                font-size: 0.11rem;
                color: #666;
                transition: color 0.5s;
            }
        }
        .actived {
            img {
                display: none;
            }
            .selected {
                display: inline-block;
            }
            p {
                color: #dd3333;
                transition: color 0.5s;
            }
        }
    }
}
</style>